<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('商品美图')" />
	<th:block th:include="include :: businessCSS" />
</head>
<body class="no-skin">
<div class="main-container" id="main-container">
	<div class="main-content">
	<form class="layui-form head-form">
	    <div class="north">
            <th:block th:include="include :: business_btn" />
	        <th:block th:include="include :: business_tpl('top')" />
    	</div>
		<div class="mid-content">
			<div style="font-weight: 700;font-size:18px;margin-bottom: 10px;">子件列表</div>
	        <table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	    </div>
	   	<th:block th:include="include :: pageFooter" /> 
        </form>
	</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<th:block th:include="include :: inlineJS" />
<script type="text/javascript">
var $,layer,form,laydate,element;//定义layui模块
var nid = $("#nid").val(),noTable;//定义全局参数
layui.use(['laydate','form','layer','jquery','util','element','upload'], function () {
 	$ = layui.$,layer = layui.layer,form = layui.form,laydate = layui.laydate,util = layui.util,element=layui.element,upload=layui.upload;
 	beforeInit();//表单初始化之前的动作集合
 	$.get("/business/productmg/listbynid?nid="+nid,function(res){
 		noTable=res.data;
	});
 	layui.element.render();

	 window.funChild=function(){
		var pcode=$('#code').val()
		$('.mid-content').show()
		$.get('/business/productactive/listzj',{'pcode':pcode}, function(res){
            console.log(res)
			$.tablelist.init({
				elem: '#dhtable'
                ,data:res.data
                ,page:false
                ,limit:10000
				,cols: [
			    	[
			    	    {type:'numbers',rowspan: 2},
			    		{field: 'pcode',title: '母件编码'},
			    		{field: 'name',title: '子件名称'},
			    		{field: 'code',title: '子件编码'},
			    		{field: 'num',title: '子件数量'},
			    		{field: 'remark',title: '子件备注'}
			    	]
			    ]
			})
		})
	}


	$(function(){ 
		$('.mid-content').hide()
        if($('#code').val()) funChild()
    });


	



})
</script>
</body>
</html>